#ifndef CONSTRAINT_H_
#define CONSTRAINT_H_
#include "../basic/Point.h"
#include "../basic/Parameter.h"
#include "../basic/MyException.h"
#include "GeometricConstraintType.h"
#include "../interface/IdAble.h"
#include "../interface/ToStringAble.h"
#include "../ads/typesDefinition.h"
#include <iostream>
#include <string>
#include <sstream>
#include <set>

namespace common {

class Constraint:public IdAble,public ToStringAble{
	int size;
	GeometricConstraintType type;
protected:

	Point* k;
	Point* l;
	Point* m;
	Point* n;
	Parameter* parameter;

	void setK(Point* _k);
	void setL(Point* _l);
	void setM(Point* _m);
	void setN(Point* _n);
	void setParameter(Parameter* param);
protected:
	void setType(GeometricConstraintType typ);

public:
	Constraint(int id,int size,GeometricConstraintType type);

	Point* getK();
	Point* getL();
	Point* getM();
	Point* getN();
	Parameter* getParameter();
	bool containsParameter();
	bool containsPoint(Point* p);

	GeometricConstraintType getType(void) const;
	int getSize() const;

	virtual ublasVector getValue() throw(MyException);
	virtual ublasMatrix getJacobianOnPoint(Point* p) throw(MyException);
	virtual ublasVector getNorm() throw(MyException);
	virtual ublasMatrix getHessian(Point* s, Point* r) throw(MyException);
	virtual bool isHessian() const;

	std::set<Point*> getAssociatedPoint();
	std::string getTypeToString();
	std::string toString(void);

	virtual ~Constraint();
};

}

#endif /* CONSTRAINT_H_ */
